//
//  CustomCollectionViewCell.m
//  豆瓣CollectionView
//
//  Created by kingbw on 16/1/29.
//  Copyright © 2016年 kingbw. All rights reserved.
//

#import "CustomCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation CustomCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imgView = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.imgView];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.titleLabel.numberOfLines = 2;
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.titleLabel];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.titleLabel.frame = CGRectMake(0, self.frame.size.height - 40, self.frame.size.width, 40);
    self.imgView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 40);
    
}

- (void)setMovieDetail:(MovieDetailModel *)movieDetail {
    _movieDetail = movieDetail;
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:movieDetail.imageModel.large]];
    self.titleLabel.text = movieDetail.title;
}


@end
